package org.primefaces.examples.moviecollector.service;

import java.util.List;
import java.util.Map;

import javax.swing.SortOrder;

import org.primefaces.examples.moviecollector.dao.SitiosTuristicosDAO;
import org.primefaces.examples.moviecollector.domain.SitiosTuristicos;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service("sitioService")
public class SitiosTuristicosServiceImpl implements SitiosTuristicoService {
	
	private SitiosTuristicosDAO sitioTDAO;
	
	
	@Autowired
	public SitiosTuristicosServiceImpl(SitiosTuristicosDAO sitioTDAO) {
		
		this.sitioTDAO = sitioTDAO;
	}

	@Transactional
	public void guardarSitio(SitiosTuristicos sitioT) {
		sitioTDAO.persist(sitioT);
		
	}

	@Transactional(readOnly=true)
	public List<SitiosTuristicos> findAll() {
		return sitioTDAO.loadAll();
	}

	@Transactional(readOnly=true)
	public List<SitiosTuristicos> findByName(String name) {
		return sitioTDAO.findByNombre(name);
	}

	@Transactional
	public void update(SitiosTuristicos sitioT) {
	
		sitioTDAO.update(sitioT);
		
	}

	@Transactional
	public void remove(SitiosTuristicos sitioT) {
		sitioTDAO.delete(sitioT);
		
	}

	@Transactional(readOnly=true)
	public SitiosTuristicos findById(Long id) {
		return sitioTDAO.loadById(id);
	}

	public List<SitiosTuristicos> loadLazy(int first, int pageSize,
			String sortField, SortOrder sortOrder, Map<String, String> filters) {
		// TODO Auto-generated method stub
		return null;
	}

	

}



